package com.didispace.web;

import com.alibaba.fastjson.JSONObject;
import com.didispace.model.LltHttpRes;
import com.didispace.model.LoanResultNotifyReqData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author 程序猿DD
 * @version 1.0.0
 * @blog http://blog.didispace.com
 *
 */
@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String index() {
        return "Hello World";
    }

    @RequestMapping(value="/loan", method=RequestMethod.POST)
    public String Loan(@RequestBody String RequestBody, HttpServletRequest request) {
        System.out.println("RequestBody: " + RequestBody);
//        LltHttpRes reqData = JSONObject.parseObject(RequestBody, LltHttpRes.class);
//        LoanResultNotifyReqData loanResultNotifyReqData = JSONObject.parseObject(reqData.getData(), LoanResultNotifyReqData.class);
//        System.out.println("loanResultNotifyReqData: " + loanResultNotifyReqData);
        return "Hello loan";
    }

    @RequestMapping(value="/credit", method=RequestMethod.POST)
    public void credit(@RequestBody String RequestBody, HttpServletRequest request) {
        System.out.println("RequestBody: " + RequestBody);
//        LltHttpRes reqData = JSONObject.parseObject(RequestBody, LltHttpRes.class);
//        LoanResultNotifyReqData loanResultNotifyReqData = JSONObject.parseObject(reqData.getData(), LoanResultNotifyReqData.class);
//        System.out.println("loanResultNotifyReqData: " + loanResultNotifyReqData);
//        return "Hello credit";
    }
}